#define  _CRT_SECURE_NO_WARNINGS


#include<stdio.h>


int main()
{
	int row = 0, col = 0, i = 0, j = 0, arr[100][100] = { 0 };
	scanf("%d %d", &row, &col);
	for (i = 0; i < row; i++)
	{
		for (j = 0; j < col; j++)
		{
			scanf("%d", &arr[i][j]);
		}
	}
	for (i = 0; i < col; i++)
	{
		for (j = 0; j < row; j++)
		{
			printf("%d ", arr[j][i]);
		}
		printf("\n");
	}
	return 0;
}